package ge.telasi.tasks.model.copy;

import ge.telasi.tasks.model.CopyService;
import ge.telasi.tasks.model.User;

/**
 * @author dimitri
 */
public class UserCopy extends CopyService<User> {

    @Override
    public User createClone(User proto) {
        User user = new User();
        copyModifiable(proto, user);
        user.setAdmin(proto.isAdmin());
        user.setCode(copyString(proto.getCode()));
        user.setEmail(copyString(proto.getEmail()));
        user.setFirstName(copyString(proto.getFirstName()));
        user.setFirstName2(copyString(proto.getFirstName2()));
        user.setLastName(copyString(proto.getLastName()));
        user.setLastName2(copyString(proto.getLastName2()));
        user.setId(proto.getId());
        user.setLastTaskSequence(proto.getLastTaskSequence());
        user.setLocation(copyString(proto.getLocation()));
        user.setMobile(copyString(proto.getMobile()));
        user.setNew(proto.isNew());
        user.setNotifyByEmail(proto.isNotifyByEmail());
        user.setNotifyByMobile(proto.isNotifyByMobile());
        user.setPosition(copyString(proto.getPosition()));
        if (proto.getStructure() != null) {
            user.setStructure(new StructureCopy().createClone(proto.getStructure()));
        }
        user.setUsername(copyString(proto.getUsername()));
        user.setWorkPhone(copyString(proto.getWorkPhone()));
        return user;
    }

}
